/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication1;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Bienes
 */
@Entity
@Table(name = "transaction_products", catalog = "starter", schema = "")
@NamedQueries({
    @NamedQuery(name = "TransactionProducts.findAll", query = "SELECT t FROM TransactionProducts t"),
    @NamedQuery(name = "TransactionProducts.findByTransNo", query = "SELECT t FROM TransactionProducts t WHERE t.transNo = :transNo"),
    @NamedQuery(name = "TransactionProducts.findByTransProductID", query = "SELECT t FROM TransactionProducts t WHERE t.transProductID = :transProductID"),
    @NamedQuery(name = "TransactionProducts.findByTransProductName", query = "SELECT t FROM TransactionProducts t WHERE t.transProductName = :transProductName"),
    @NamedQuery(name = "TransactionProducts.findByTransProductPrice", query = "SELECT t FROM TransactionProducts t WHERE t.transProductPrice = :transProductPrice"),
    @NamedQuery(name = "TransactionProducts.findByProductQuantity", query = "SELECT t FROM TransactionProducts t WHERE t.productQuantity = :productQuantity"),
    @NamedQuery(name = "TransactionProducts.findByProductTotal", query = "SELECT t FROM TransactionProducts t WHERE t.productTotal = :productTotal")})
public class TransactionProducts implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "TransNo")
    private Integer transNo;
    @Column(name = "TransProductID")
    private Integer transProductID;
    @Column(name = "TransProductName")
    private String transProductName;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "TransProductPrice")
    private Float transProductPrice;
    @Column(name = "ProductQuantity")
    private Integer productQuantity;
    @Column(name = "ProductTotal")
    private Float productTotal;

    public TransactionProducts() {
    }

    public TransactionProducts(Integer transNo) {
        this.transNo = transNo;
    }

    public Integer getTransNo() {
        return transNo;
    }

    public void setTransNo(Integer transNo) {
        Integer oldTransNo = this.transNo;
        this.transNo = transNo;
        changeSupport.firePropertyChange("transNo", oldTransNo, transNo);
    }

    public Integer getTransProductID() {
        return transProductID;
    }

    public void setTransProductID(Integer transProductID) {
        Integer oldTransProductID = this.transProductID;
        this.transProductID = transProductID;
        changeSupport.firePropertyChange("transProductID", oldTransProductID, transProductID);
    }

    public String getTransProductName() {
        return transProductName;
    }

    public void setTransProductName(String transProductName) {
        String oldTransProductName = this.transProductName;
        this.transProductName = transProductName;
        changeSupport.firePropertyChange("transProductName", oldTransProductName, transProductName);
    }

    public Float getTransProductPrice() {
        return transProductPrice;
    }

    public void setTransProductPrice(Float transProductPrice) {
        Float oldTransProductPrice = this.transProductPrice;
        this.transProductPrice = transProductPrice;
        changeSupport.firePropertyChange("transProductPrice", oldTransProductPrice, transProductPrice);
    }

    public Integer getProductQuantity() {
        return productQuantity;
    }

    public void setProductQuantity(Integer productQuantity) {
        Integer oldProductQuantity = this.productQuantity;
        this.productQuantity = productQuantity;
        changeSupport.firePropertyChange("productQuantity", oldProductQuantity, productQuantity);
    }

    public Float getProductTotal() {
        return productTotal;
    }

    public void setProductTotal(Float productTotal) {
        Float oldProductTotal = this.productTotal;
        this.productTotal = productTotal;
        changeSupport.firePropertyChange("productTotal", oldProductTotal, productTotal);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (transNo != null ? transNo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TransactionProducts)) {
            return false;
        }
        TransactionProducts other = (TransactionProducts) object;
        if ((this.transNo == null && other.transNo != null) || (this.transNo != null && !this.transNo.equals(other.transNo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "javaapplication1.TransactionProducts[ transNo=" + transNo + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
